package statefulbeans;

import java.util.ArrayList;

import javax.ejb.EJB;
import javax.ejb.Stateful;

import dao.CandidateDAORemote;
import dto.CandidateViewDto;
import dto.InterviewViewDto;

/**
 * Session Bean implementation class TesterInterviewBean
 */
@Stateful
public class TesterInterviewBean implements TesterInterviewBeanRemote {
	@EJB
	CandidateDAORemote candidateBean;
	private ArrayList<CandidateViewDto> candidates = new ArrayList<CandidateViewDto>();
	private int employeeid = 1;
    /**
     * Default constructor. 
     */
    public TesterInterviewBean() {
        // TODO Auto-generated constructor stub
    }
    
   
	public void setCandidates(ArrayList<CandidateViewDto> candidates) {
		this.candidates = candidates;
	}
	public ArrayList<CandidateViewDto> getCandidates() {
		return candidates;
	}
	public void setEmployeeid(int employeeid) {
		this.employeeid = employeeid;
		candidates = (ArrayList<CandidateViewDto>) candidateBean
		.getCandidates(employeeid);
		
	}
	public int getEmployeeid() {
		return employeeid;
	}
	public void addInterview(InterviewViewDto interview, CandidateViewDto candidate){
		candidates.remove(candidate);
		candidate.getInterviews().add(interview);
		candidates.add(candidate);
		
	}
	public void aremoveInterview(InterviewViewDto interview, CandidateViewDto candidate){
		candidates.remove(candidate);
		candidate.getInterviews().remove(interview);
		candidates.add(candidate);
		
	}
   
}
